package com.winchain.provider.expiration.rx;

import com.shell.bee.persistence.transaction.Transaction;
import com.shell.bee.persistence.transaction.TransactionUtil;
import com.shell.framework.rx.OnErrorNotImplementedSubscriber;
import com.winchain.basic.exception.ExtException;
import org.apache.commons.logging.Log;

public abstract class TransactionNewSubscriber<T> extends OnErrorNotImplementedSubscriber<T> {
	public void onApplicationEvent(final T t) {
		try {
			TransactionUtil.execute(new Transaction() {
				public void doInTransaction() {
					TransactionNewSubscriber.this.execute(t);
				}
			}, new int[0]);
		} catch (Exception e) {
			e.printStackTrace();
			this.logger.error(getClass() + "��������", e);
			throw new ExtException(e.getMessage());
		}
	}

	public abstract void execute(T paramT);
}
